package logic.nodes.collision;

import sound.AudioManager;
import logic.nodes.damagable.DamagableNode;

public class ShieldCollision extends Collision {
	
	public ShieldCollision(CollidableNode a, CollidableNode b) {
		super(a, b);
	}
	
	@Override
	protected void computeLocations() {
		aToB = b.getLocalTranslation().subtract(a.getLocalTranslation()).normalize();
	}
	
	@Override
	protected void postProcessing() {
		shieldImpact(a, b);
		shieldImpact(b, a);
	}
	
	protected void shieldImpact(CollidableNode node, CollidableNode other) {
		if(node instanceof DamagableNode) ((DamagableNode)node).shieldImpact(other);
	}
	
	@Override
	protected String getCollisionSound() { return AudioManager.COLLISION_02; }
}